.class public Lorg/jboss/netty/handler/codec/spdy/SpdyFrameDecoder;
.super Lorg/jboss/netty/handler/codec/frame/FrameDecoder;
.source "SpdyFrameDecoder.java"


# instance fields
.field private final headerBlockDecompressor:Lorg/jboss/netty/handler/codec/embedder/DecoderEmbedder;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Lorg/jboss/netty/handler/codec/embedder/DecoderEmbedder",
            "<",
            "Lorg/jboss/netty/buffer/ChannelBuffer;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method public constructor <init>()V
    .locals 5

    .prologue
    .line 36
    invoke-direct {p0}, Lorg/jboss/netty/handler/codec/frame/FrameDecoder;-><init>()V

    .line 32
    new-instance v0, Lorg/jboss/netty/handler/codec/embedder/DecoderEmbedder;

    const/4 v1, 0x1

    new-array v1, v1, [Lorg/jboss/netty/channel/ChannelUpstreamHandler;

    const/4 v2, 0x0

    new-instance v3, Lorg/jboss/netty/handler/codec/compression/ZlibDecoder;

    sget-object v4, Lorg/jboss/netty/handler/codec/spdy/SpdyCodecUtil;->SPDY_DICT:[B

    invoke-direct {v3, v4}, Lorg/jboss/netty/handler/codec/compression/ZlibDecoder;-><init>([B)V

    aput-object v3, v1, v2

    invoke-direct {v0, v1}, Lorg/jboss/netty/handler/codec/embedder/DecoderEmbedder;-><init>([Lorg/jboss/netty/channel/ChannelUpstreamHandler;)V

    iput-object v0, p0, Lorg/jboss/netty/handler/codec/spdy/SpdyFrameDecoder;->headerBlockDecompressor:Lorg/jboss/netty/handler/codec/embedder/DecoderEmbedder;

    .line 37
    return-void
.end method

.method private decodeControlFrame(IBLorg/jboss/netty/buffer/ChannelBuffer;)Ljava/lang/Object;
    .locals 24
    .parameter "type"
    .parameter "flags"
    .parameter "data"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/Exception;
        }
    .end annotation

    .prologue
    .line 100
    packed-switch p1, :pswitch_data_0

    .line 245
    const/16 v17, 0x0

    :goto_0
    return-object v17

    .line 102
    :pswitch_0
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readableBytes()I

    move-result v22

    const/16 v23, 0xc

    move/from16 v0, v22

    move/from16 v1, v23

    if-ge v0, v1, :cond_0

    .line 103
    new-instance v22, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;

    const-string v23, "Received invalid SYN_STREAM control frame"

    invoke-direct/range {v22 .. v23}, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;-><init>(Ljava/lang/String;)V

    throw v22

    .line 106
    :cond_0
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readerIndex()I

    move-result v22

    move-object/from16 v0, p3

    move/from16 v1, v22

    invoke-static {v0, v1}, Lorg/jboss/netty/handler/codec/spdy/SpdyCodecUtil;->getUnsignedInt(Lorg/jboss/netty/buffer/ChannelBuffer;I)I

    move-result v19

    .line 107
    .local v19, streamID:I
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readerIndex()I

    move-result v22

    add-int/lit8 v22, v22, 0x4

    move-object/from16 v0, p3

    move/from16 v1, v22

    invoke-static {v0, v1}, Lorg/jboss/netty/handler/codec/spdy/SpdyCodecUtil;->getUnsignedInt(Lorg/jboss/netty/buffer/ChannelBuffer;I)I

    move-result v5

    .line 108
    .local v5, associatedToStreamID:I
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readerIndex()I

    move-result v22

    add-int/lit8 v22, v22, 0x8

    move-object/from16 v0, p3

    move/from16 v1, v22

    invoke-interface {v0, v1}, Lorg/jboss/netty/buffer/ChannelBuffer;->getByte(I)B

    move-result v22

    shr-int/lit8 v22, v22, 0x6

    and-int/lit8 v22, v22, 0x3

    move/from16 v0, v22

    int-to-byte v13, v0

    .line 109
    .local v13, priority:B
    const/16 v22, 0xa

    move-object/from16 v0, p3

    move/from16 v1, v22

    invoke-interface {v0, v1}, Lorg/jboss/netty/buffer/ChannelBuffer;->skipBytes(I)V

    .line 111
    new-instance v17, Lorg/jboss/netty/handler/codec/spdy/DefaultSpdySynStreamFrame;

    move-object/from16 v0, v17

    move/from16 v1, v19

    invoke-direct {v0, v1, v5, v13}, Lorg/jboss/netty/handler/codec/spdy/DefaultSpdySynStreamFrame;-><init>(IIB)V

    .line 114
    .local v17, spdySynStreamFrame:Lorg/jboss/netty/handler/codec/spdy/SpdySynStreamFrame;
    and-int/lit8 v22, p2, 0x1

    if-eqz v22, :cond_1

    const/4 v8, 0x1

    .line 115
    .local v8, last:Z
    :goto_1
    and-int/lit8 v22, p2, 0x2

    if-eqz v22, :cond_2

    const/16 v20, 0x1

    .line 116
    .local v20, unid:Z
    :goto_2
    move-object/from16 v0, v17

    invoke-interface {v0, v8}, Lorg/jboss/netty/handler/codec/spdy/SpdySynStreamFrame;->setLast(Z)V

    .line 117
    move-object/from16 v0, v17

    move/from16 v1, v20

    invoke-interface {v0, v1}, Lorg/jboss/netty/handler/codec/spdy/SpdySynStreamFrame;->setUnidirectional(Z)V

    .line 119
    move-object/from16 v0, p0

    move-object/from16 v1, p3

    invoke-direct {v0, v1}, Lorg/jboss/netty/handler/codec/spdy/SpdyFrameDecoder;->decompress(Lorg/jboss/netty/buffer/ChannelBuffer;)Lorg/jboss/netty/buffer/ChannelBuffer;

    move-result-object v22

    move-object/from16 v0, p0

    move-object/from16 v1, v17

    move-object/from16 v2, v22

    invoke-direct {v0, v1, v2}, Lorg/jboss/netty/handler/codec/spdy/SpdyFrameDecoder;->decodeHeaderBlock(Lorg/jboss/netty/handler/codec/spdy/SpdyHeaderBlock;Lorg/jboss/netty/buffer/ChannelBuffer;)V

    goto :goto_0

    .line 114
    .end local v8           #last:Z
    .end local v20           #unid:Z
    :cond_1
    const/4 v8, 0x0

    goto :goto_1

    .line 115
    .restart local v8       #last:Z
    :cond_2
    const/16 v20, 0x0

    goto :goto_2

    .line 124
    .end local v5           #associatedToStreamID:I
    .end local v8           #last:Z
    .end local v13           #priority:B
    .end local v17           #spdySynStreamFrame:Lorg/jboss/netty/handler/codec/spdy/SpdySynStreamFrame;
    .end local v19           #streamID:I
    :pswitch_1
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readableBytes()I

    move-result v22

    const/16 v23, 0x8

    move/from16 v0, v22

    move/from16 v1, v23

    if-ge v0, v1, :cond_3

    .line 125
    new-instance v22, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;

    const-string v23, "Received invalid SYN_REPLY control frame"

    invoke-direct/range {v22 .. v23}, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;-><init>(Ljava/lang/String;)V

    throw v22

    .line 128
    :cond_3
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readerIndex()I

    move-result v22

    move-object/from16 v0, p3

    move/from16 v1, v22

    invoke-static {v0, v1}, Lorg/jboss/netty/handler/codec/spdy/SpdyCodecUtil;->getUnsignedInt(Lorg/jboss/netty/buffer/ChannelBuffer;I)I

    move-result v19

    .line 129
    .restart local v19       #streamID:I
    const/16 v22, 0x6

    move-object/from16 v0, p3

    move/from16 v1, v22

    invoke-interface {v0, v1}, Lorg/jboss/netty/buffer/ChannelBuffer;->skipBytes(I)V

    .line 131
    new-instance v16, Lorg/jboss/netty/handler/codec/spdy/DefaultSpdySynReplyFrame;

    move-object/from16 v0, v16

    move/from16 v1, v19

    invoke-direct {v0, v1}, Lorg/jboss/netty/handler/codec/spdy/DefaultSpdySynReplyFrame;-><init>(I)V

    .line 134
    .local v16, spdySynReplyFrame:Lorg/jboss/netty/handler/codec/spdy/SpdySynReplyFrame;
    and-int/lit8 v22, p2, 0x1

    if-eqz v22, :cond_4

    const/4 v8, 0x1

    .line 135
    .restart local v8       #last:Z
    :goto_3
    move-object/from16 v0, v16

    invoke-interface {v0, v8}, Lorg/jboss/netty/handler/codec/spdy/SpdySynReplyFrame;->setLast(Z)V

    .line 137
    move-object/from16 v0, p0

    move-object/from16 v1, p3

    invoke-direct {v0, v1}, Lorg/jboss/netty/handler/codec/spdy/SpdyFrameDecoder;->decompress(Lorg/jboss/netty/buffer/ChannelBuffer;)Lorg/jboss/netty/buffer/ChannelBuffer;

    move-result-object v22

    move-object/from16 v0, p0

    move-object/from16 v1, v16

    move-object/from16 v2, v22

    invoke-direct {v0, v1, v2}, Lorg/jboss/netty/handler/codec/spdy/SpdyFrameDecoder;->decodeHeaderBlock(Lorg/jboss/netty/handler/codec/spdy/SpdyHeaderBlock;Lorg/jboss/netty/buffer/ChannelBuffer;)V

    move-object/from16 v17, v16

    .line 139
    goto/16 :goto_0

    .line 134
    .end local v8           #last:Z
    :cond_4
    const/4 v8, 0x0

    goto :goto_3

    .line 142
    .end local v16           #spdySynReplyFrame:Lorg/jboss/netty/handler/codec/spdy/SpdySynReplyFrame;
    .end local v19           #streamID:I
    :pswitch_2
    if-nez p2, :cond_5

    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readableBytes()I

    move-result v22

    const/16 v23, 0x8

    move/from16 v0, v22

    move/from16 v1, v23

    if-eq v0, v1, :cond_6

    .line 143
    :cond_5
    new-instance v22, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;

    const-string v23, "Received invalid RST_STREAM control frame"

    invoke-direct/range {v22 .. v23}, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;-><init>(Ljava/lang/String;)V

    throw v22

    .line 146
    :cond_6
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readerIndex()I

    move-result v22

    move-object/from16 v0, p3

    move/from16 v1, v22

    invoke-static {v0, v1}, Lorg/jboss/netty/handler/codec/spdy/SpdyCodecUtil;->getUnsignedInt(Lorg/jboss/netty/buffer/ChannelBuffer;I)I

    move-result v19

    .line 147
    .restart local v19       #streamID:I
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readerIndex()I

    move-result v22

    add-int/lit8 v22, v22, 0x4

    move-object/from16 v0, p3

    move/from16 v1, v22

    invoke-static {v0, v1}, Lorg/jboss/netty/handler/codec/spdy/SpdyCodecUtil;->getSignedInt(Lorg/jboss/netty/buffer/ChannelBuffer;I)I

    move-result v18

    .line 148
    .local v18, statusCode:I
    if-nez v18, :cond_7

    .line 149
    new-instance v22, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;

    const-string v23, "Received invalid RST_STREAM status code"

    invoke-direct/range {v22 .. v23}, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;-><init>(Ljava/lang/String;)V

    throw v22

    .line 153
    :cond_7
    new-instance v17, Lorg/jboss/netty/handler/codec/spdy/DefaultSpdyRstStreamFrame;

    move-object/from16 v0, v17

    move/from16 v1, v19

    move/from16 v2, v18

    invoke-direct {v0, v1, v2}, Lorg/jboss/netty/handler/codec/spdy/DefaultSpdyRstStreamFrame;-><init>(II)V

    goto/16 :goto_0

    .line 156
    .end local v18           #statusCode:I
    .end local v19           #streamID:I
    :pswitch_3
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readableBytes()I

    move-result v22

    const/16 v23, 0x4

    move/from16 v0, v22

    move/from16 v1, v23

    if-ge v0, v1, :cond_8

    .line 157
    new-instance v22, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;

    const-string v23, "Received invalid SETTINGS control frame"

    invoke-direct/range {v22 .. v23}, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;-><init>(Ljava/lang/String;)V

    throw v22

    .line 162
    :cond_8
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readerIndex()I

    move-result v22

    move-object/from16 v0, p3

    move/from16 v1, v22

    invoke-static {v0, v1}, Lorg/jboss/netty/handler/codec/spdy/SpdyCodecUtil;->getUnsignedInt(Lorg/jboss/netty/buffer/ChannelBuffer;I)I

    move-result v10

    .line 163
    .local v10, numEntries:I
    const v22, 0x1fffff

    move/from16 v0, v22

    if-gt v10, v0, :cond_9

    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readableBytes()I

    move-result v22

    mul-int/lit8 v23, v10, 0x8

    add-int/lit8 v23, v23, 0x4

    move/from16 v0, v22

    move/from16 v1, v23

    if-eq v0, v1, :cond_a

    .line 165
    :cond_9
    new-instance v22, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;

    const-string v23, "Received invalid SETTINGS control frame"

    invoke-direct/range {v22 .. v23}, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;-><init>(Ljava/lang/String;)V

    throw v22

    .line 168
    :cond_a
    const/16 v22, 0x4

    move-object/from16 v0, p3

    move/from16 v1, v22

    invoke-interface {v0, v1}, Lorg/jboss/netty/buffer/ChannelBuffer;->skipBytes(I)V

    .line 170
    new-instance v15, Lorg/jboss/netty/handler/codec/spdy/DefaultSpdySettingsFrame;

    invoke-direct {v15}, Lorg/jboss/netty/handler/codec/spdy/DefaultSpdySettingsFrame;-><init>()V

    .line 172
    .local v15, spdySettingsFrame:Lorg/jboss/netty/handler/codec/spdy/SpdySettingsFrame;
    and-int/lit8 v22, p2, 0x1

    if-eqz v22, :cond_c

    const/4 v6, 0x1

    .line 173
    .local v6, clear:Z
    :goto_4
    invoke-interface {v15, v6}, Lorg/jboss/netty/handler/codec/spdy/SpdySettingsFrame;->setClearPreviouslyPersistedSettings(Z)V

    .line 175
    const/4 v7, 0x0

    .local v7, i:I
    :goto_5
    if-ge v7, v10, :cond_f

    .line 179
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readByte()B

    move-result v22

    move/from16 v0, v22

    and-int/lit16 v0, v0, 0xff

    move/from16 v22, v0

    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readByte()B

    move-result v23

    move/from16 v0, v23

    and-int/lit16 v0, v0, 0xff

    move/from16 v23, v0

    shl-int/lit8 v23, v23, 0x8

    or-int v22, v22, v23

    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readByte()B

    move-result v23

    move/from16 v0, v23

    and-int/lit16 v0, v0, 0xff

    move/from16 v23, v0

    shl-int/lit8 v23, v23, 0x10

    or-int v3, v22, v23

    .line 182
    .local v3, ID:I
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readByte()B

    move-result v4

    .line 183
    .local v4, ID_flags:B
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readerIndex()I

    move-result v22

    move-object/from16 v0, p3

    move/from16 v1, v22

    invoke-static {v0, v1}, Lorg/jboss/netty/handler/codec/spdy/SpdyCodecUtil;->getSignedInt(Lorg/jboss/netty/buffer/ChannelBuffer;I)I

    move-result v21

    .line 184
    .local v21, value:I
    const/16 v22, 0x4

    move-object/from16 v0, p3

    move/from16 v1, v22

    invoke-interface {v0, v1}, Lorg/jboss/netty/buffer/ChannelBuffer;->skipBytes(I)V

    .line 186
    invoke-interface {v15, v3}, Lorg/jboss/netty/handler/codec/spdy/SpdySettingsFrame;->isSet(I)Z

    move-result v22

    if-nez v22, :cond_b

    .line 187
    and-int/lit8 v22, v4, 0x1

    if-eqz v22, :cond_d

    const/4 v11, 0x1

    .line 188
    .local v11, persistVal:Z
    :goto_6
    and-int/lit8 v22, v4, 0x2

    if-eqz v22, :cond_e

    const/4 v12, 0x1

    .line 189
    .local v12, persisted:Z
    :goto_7
    move/from16 v0, v21

    invoke-interface {v15, v3, v0, v11, v12}, Lorg/jboss/netty/handler/codec/spdy/SpdySettingsFrame;->setValue(IIZZ)V

    .line 175
    .end local v11           #persistVal:Z
    .end local v12           #persisted:Z
    :cond_b
    add-int/lit8 v7, v7, 0x1

    goto :goto_5

    .line 172
    .end local v3           #ID:I
    .end local v4           #ID_flags:B
    .end local v6           #clear:Z
    .end local v7           #i:I
    .end local v21           #value:I
    :cond_c
    const/4 v6, 0x0

    goto :goto_4

    .line 187
    .restart local v3       #ID:I
    .restart local v4       #ID_flags:B
    .restart local v6       #clear:Z
    .restart local v7       #i:I
    .restart local v21       #value:I
    :cond_d
    const/4 v11, 0x0

    goto :goto_6

    .line 188
    .restart local v11       #persistVal:Z
    :cond_e
    const/4 v12, 0x0

    goto :goto_7

    .end local v3           #ID:I
    .end local v4           #ID_flags:B
    .end local v11           #persistVal:Z
    .end local v21           #value:I
    :cond_f
    move-object/from16 v17, v15

    .line 193
    goto/16 :goto_0

    .line 196
    .end local v6           #clear:Z
    .end local v7           #i:I
    .end local v10           #numEntries:I
    .end local v15           #spdySettingsFrame:Lorg/jboss/netty/handler/codec/spdy/SpdySettingsFrame;
    :pswitch_4
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readableBytes()I

    move-result v22

    if-eqz v22, :cond_10

    .line 197
    new-instance v22, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;

    const-string v23, "Received invalid NOOP control frame"

    invoke-direct/range {v22 .. v23}, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;-><init>(Ljava/lang/String;)V

    throw v22

    .line 201
    :cond_10
    const/16 v17, 0x0

    goto/16 :goto_0

    .line 204
    :pswitch_5
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readableBytes()I

    move-result v22

    const/16 v23, 0x4

    move/from16 v0, v22

    move/from16 v1, v23

    if-eq v0, v1, :cond_11

    .line 205
    new-instance v22, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;

    const-string v23, "Received invalid PING control frame"

    invoke-direct/range {v22 .. v23}, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;-><init>(Ljava/lang/String;)V

    throw v22

    .line 208
    :cond_11
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readerIndex()I

    move-result v22

    move-object/from16 v0, p3

    move/from16 v1, v22

    invoke-static {v0, v1}, Lorg/jboss/netty/handler/codec/spdy/SpdyCodecUtil;->getSignedInt(Lorg/jboss/netty/buffer/ChannelBuffer;I)I

    move-result v3

    .line 210
    .restart local v3       #ID:I
    new-instance v17, Lorg/jboss/netty/handler/codec/spdy/DefaultSpdyPingFrame;

    move-object/from16 v0, v17

    invoke-direct {v0, v3}, Lorg/jboss/netty/handler/codec/spdy/DefaultSpdyPingFrame;-><init>(I)V

    goto/16 :goto_0

    .line 213
    .end local v3           #ID:I
    :pswitch_6
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readableBytes()I

    move-result v22

    const/16 v23, 0x4

    move/from16 v0, v22

    move/from16 v1, v23

    if-eq v0, v1, :cond_12

    .line 214
    new-instance v22, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;

    const-string v23, "Received invalid GOAWAY control frame"

    invoke-direct/range {v22 .. v23}, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;-><init>(Ljava/lang/String;)V

    throw v22

    .line 217
    :cond_12
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readerIndex()I

    move-result v22

    move-object/from16 v0, p3

    move/from16 v1, v22

    invoke-static {v0, v1}, Lorg/jboss/netty/handler/codec/spdy/SpdyCodecUtil;->getUnsignedInt(Lorg/jboss/netty/buffer/ChannelBuffer;I)I

    move-result v9

    .line 219
    .local v9, lastGoodStreamID:I
    new-instance v17, Lorg/jboss/netty/handler/codec/spdy/DefaultSpdyGoAwayFrame;

    move-object/from16 v0, v17

    invoke-direct {v0, v9}, Lorg/jboss/netty/handler/codec/spdy/DefaultSpdyGoAwayFrame;-><init>(I)V

    goto/16 :goto_0

    .line 223
    .end local v9           #lastGoodStreamID:I
    :pswitch_7
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readableBytes()I

    move-result v22

    const/16 v23, 0x4

    move/from16 v0, v22

    move/from16 v1, v23

    if-ne v0, v1, :cond_13

    .line 224
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readerIndex()I

    move-result v22

    move-object/from16 v0, p3

    move/from16 v1, v22

    invoke-static {v0, v1}, Lorg/jboss/netty/handler/codec/spdy/SpdyCodecUtil;->getUnsignedInt(Lorg/jboss/netty/buffer/ChannelBuffer;I)I

    move-result v19

    .line 225
    .restart local v19       #streamID:I
    new-instance v17, Lorg/jboss/netty/handler/codec/spdy/DefaultSpdyHeadersFrame;

    move-object/from16 v0, v17

    move/from16 v1, v19

    invoke-direct {v0, v1}, Lorg/jboss/netty/handler/codec/spdy/DefaultSpdyHeadersFrame;-><init>(I)V

    goto/16 :goto_0

    .line 228
    .end local v19           #streamID:I
    :cond_13
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readableBytes()I

    move-result v22

    const/16 v23, 0x8

    move/from16 v0, v22

    move/from16 v1, v23

    if-ge v0, v1, :cond_14

    .line 229
    new-instance v22, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;

    const-string v23, "Received invalid HEADERS control frame"

    invoke-direct/range {v22 .. v23}, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;-><init>(Ljava/lang/String;)V

    throw v22

    .line 232
    :cond_14
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readerIndex()I

    move-result v22

    move-object/from16 v0, p3

    move/from16 v1, v22

    invoke-static {v0, v1}, Lorg/jboss/netty/handler/codec/spdy/SpdyCodecUtil;->getUnsignedInt(Lorg/jboss/netty/buffer/ChannelBuffer;I)I

    move-result v19

    .line 233
    .restart local v19       #streamID:I
    const/16 v22, 0x6

    move-object/from16 v0, p3

    move/from16 v1, v22

    invoke-interface {v0, v1}, Lorg/jboss/netty/buffer/ChannelBuffer;->skipBytes(I)V

    .line 235
    new-instance v14, Lorg/jboss/netty/handler/codec/spdy/DefaultSpdyHeadersFrame;

    move/from16 v0, v19

    invoke-direct {v14, v0}, Lorg/jboss/netty/handler/codec/spdy/DefaultSpdyHeadersFrame;-><init>(I)V

    .line 237
    .local v14, spdyHeadersFrame:Lorg/jboss/netty/handler/codec/spdy/SpdyHeadersFrame;
    move-object/from16 v0, p0

    move-object/from16 v1, p3

    invoke-direct {v0, v1}, Lorg/jboss/netty/handler/codec/spdy/SpdyFrameDecoder;->decompress(Lorg/jboss/netty/buffer/ChannelBuffer;)Lorg/jboss/netty/buffer/ChannelBuffer;

    move-result-object v22

    move-object/from16 v0, p0

    move-object/from16 v1, v22

    invoke-direct {v0, v14, v1}, Lorg/jboss/netty/handler/codec/spdy/SpdyFrameDecoder;->decodeHeaderBlock(Lorg/jboss/netty/handler/codec/spdy/SpdyHeaderBlock;Lorg/jboss/netty/buffer/ChannelBuffer;)V

    move-object/from16 v17, v14

    .line 239
    goto/16 :goto_0

    .line 242
    .end local v14           #spdyHeadersFrame:Lorg/jboss/netty/handler/codec/spdy/SpdyHeadersFrame;
    .end local v19           #streamID:I
    :pswitch_8
    const/16 v17, 0x0

    goto/16 :goto_0

    .line 100
    :pswitch_data_0
    .packed-switch 0x1
        :pswitch_0
        :pswitch_1
        :pswitch_2
        :pswitch_3
        :pswitch_4
        :pswitch_5
        :pswitch_6
        :pswitch_7
        :pswitch_8
    .end packed-switch
.end method

.method private decodeHeaderBlock(Lorg/jboss/netty/handler/codec/spdy/SpdyHeaderBlock;Lorg/jboss/netty/buffer/ChannelBuffer;)V
    .locals 13
    .parameter "headerFrame"
    .parameter "headerBlock"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/Exception;
        }
    .end annotation

    .prologue
    const/4 v12, 0x2

    .line 260
    invoke-interface {p2}, Lorg/jboss/netty/buffer/ChannelBuffer;->readableBytes()I

    move-result v10

    if-ge v10, v12, :cond_0

    .line 261
    new-instance v10, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;

    const-string v11, "Received invalid header block"

    invoke-direct {v10, v11}, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;-><init>(Ljava/lang/String;)V

    throw v10

    .line 264
    :cond_0
    invoke-interface {p2}, Lorg/jboss/netty/buffer/ChannelBuffer;->readerIndex()I

    move-result v10

    invoke-static {p2, v10}, Lorg/jboss/netty/handler/codec/spdy/SpdyCodecUtil;->getUnsignedShort(Lorg/jboss/netty/buffer/ChannelBuffer;I)I

    move-result v5

    .line 265
    .local v5, numEntries:I
    invoke-interface {p2, v12}, Lorg/jboss/netty/buffer/ChannelBuffer;->skipBytes(I)V

    .line 266
    const/4 v0, 0x0

    .local v0, i:I
    :goto_0
    if-ge v0, v5, :cond_2

    .line 267
    invoke-interface {p2}, Lorg/jboss/netty/buffer/ChannelBuffer;->readableBytes()I

    move-result v10

    if-ge v10, v12, :cond_1

    .line 268
    new-instance v10, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;

    const-string v11, "Received invalid header block"

    invoke-direct {v10, v11}, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;-><init>(Ljava/lang/String;)V

    throw v10

    .line 271
    :cond_1
    invoke-interface {p2}, Lorg/jboss/netty/buffer/ChannelBuffer;->readerIndex()I

    move-result v10

    invoke-static {p2, v10}, Lorg/jboss/netty/handler/codec/spdy/SpdyCodecUtil;->getUnsignedShort(Lorg/jboss/netty/buffer/ChannelBuffer;I)I

    move-result v4

    .line 272
    .local v4, nameLength:I
    invoke-interface {p2, v12}, Lorg/jboss/netty/buffer/ChannelBuffer;->skipBytes(I)V

    .line 273
    if-nez v4, :cond_3

    .line 274
    invoke-interface {p1}, Lorg/jboss/netty/handler/codec/spdy/SpdyHeaderBlock;->setInvalid()V

    .line 321
    .end local v4           #nameLength:I
    :cond_2
    :goto_1
    return-void

    .line 277
    .restart local v4       #nameLength:I
    :cond_3
    invoke-interface {p2}, Lorg/jboss/netty/buffer/ChannelBuffer;->readableBytes()I

    move-result v10

    if-ge v10, v4, :cond_4

    .line 278
    new-instance v10, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;

    const-string v11, "Received invalid header block"

    invoke-direct {v10, v11}, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;-><init>(Ljava/lang/String;)V

    throw v10

    .line 281
    :cond_4
    new-array v3, v4, [B

    .line 282
    .local v3, nameBytes:[B
    invoke-interface {p2, v3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readBytes([B)V

    .line 283
    new-instance v2, Ljava/lang/String;

    const-string v10, "UTF-8"

    invoke-direct {v2, v3, v10}, Ljava/lang/String;-><init>([BLjava/lang/String;)V

    .line 284
    .local v2, name:Ljava/lang/String;
    invoke-interface {p1, v2}, Lorg/jboss/netty/handler/codec/spdy/SpdyHeaderBlock;->containsHeader(Ljava/lang/String;)Z

    move-result v10

    if-eqz v10, :cond_5

    .line 285
    new-instance v10, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;

    new-instance v11, Ljava/lang/StringBuilder;

    invoke-direct {v11}, Ljava/lang/StringBuilder;-><init>()V

    const-string v12, "Received duplicate header name: "

    invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v11

    invoke-virtual {v11, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v11

    invoke-virtual {v11}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v11

    invoke-direct {v10, v11}, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;-><init>(Ljava/lang/String;)V

    throw v10

    .line 288
    :cond_5
    invoke-interface {p2}, Lorg/jboss/netty/buffer/ChannelBuffer;->readableBytes()I

    move-result v10

    if-ge v10, v12, :cond_6

    .line 289
    new-instance v10, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;

    const-string v11, "Received invalid header block"

    invoke-direct {v10, v11}, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;-><init>(Ljava/lang/String;)V

    throw v10

    .line 292
    :cond_6
    invoke-interface {p2}, Lorg/jboss/netty/buffer/ChannelBuffer;->readerIndex()I

    move-result v10

    invoke-static {p2, v10}, Lorg/jboss/netty/handler/codec/spdy/SpdyCodecUtil;->getUnsignedShort(Lorg/jboss/netty/buffer/ChannelBuffer;I)I

    move-result v9

    .line 293
    .local v9, valueLength:I
    invoke-interface {p2, v12}, Lorg/jboss/netty/buffer/ChannelBuffer;->skipBytes(I)V

    .line 294
    if-nez v9, :cond_7

    .line 295
    invoke-interface {p1}, Lorg/jboss/netty/handler/codec/spdy/SpdyHeaderBlock;->setInvalid()V

    goto :goto_1

    .line 298
    :cond_7
    invoke-interface {p2}, Lorg/jboss/netty/buffer/ChannelBuffer;->readableBytes()I

    move-result v10

    if-ge v10, v9, :cond_8

    .line 299
    new-instance v10, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;

    const-string v11, "Received invalid header block"

    invoke-direct {v10, v11}, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;-><init>(Ljava/lang/String;)V

    throw v10

    .line 302
    :cond_8
    new-array v8, v9, [B

    .line 303
    .local v8, valueBytes:[B
    invoke-interface {p2, v8}, Lorg/jboss/netty/buffer/ChannelBuffer;->readBytes([B)V

    .line 304
    const/4 v1, 0x0

    .line 305
    .local v1, index:I
    const/4 v6, 0x0

    .line 306
    .local v6, offset:I
    :goto_2
    array-length v10, v8

    if-ge v1, v10, :cond_b

    .line 307
    :goto_3
    array-length v10, v8

    if-ge v1, v10, :cond_9

    aget-byte v10, v8, v1

    if-eqz v10, :cond_9

    .line 308
    add-int/lit8 v1, v1, 0x1

    goto :goto_3

    .line 310
    :cond_9
    array-length v10, v8

    if-ge v1, v10, :cond_a

    add-int/lit8 v10, v1, 0x1

    aget-byte v10, v8, v10

    if-nez v10, :cond_a

    .line 312
    invoke-interface {p1}, Lorg/jboss/netty/handler/codec/spdy/SpdyHeaderBlock;->setInvalid()V

    goto/16 :goto_1

    .line 315
    :cond_a
    new-instance v7, Ljava/lang/String;

    sub-int v10, v1, v6

    const-string v11, "UTF-8"

    invoke-direct {v7, v8, v6, v10, v11}, Ljava/lang/String;-><init>([BIILjava/lang/String;)V

    .line 316
    .local v7, value:Ljava/lang/String;
    invoke-interface {p1, v2, v7}, Lorg/jboss/netty/handler/codec/spdy/SpdyHeaderBlock;->addHeader(Ljava/lang/String;Ljava/lang/Object;)V

    .line 317
    add-int/lit8 v1, v1, 0x1

    .line 318
    move v6, v1

    .line 319
    goto :goto_2

    .line 266
    .end local v7           #value:Ljava/lang/String;
    :cond_b
    add-int/lit8 v0, v0, 0x1

    goto/16 :goto_0
.end method

.method private decompress(Lorg/jboss/netty/buffer/ChannelBuffer;)Lorg/jboss/netty/buffer/ChannelBuffer;
    .locals 2
    .parameter "compressed"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/Exception;
        }
    .end annotation

    .prologue
    .line 250
    invoke-interface {p1}, Lorg/jboss/netty/buffer/ChannelBuffer;->readableBytes()I

    move-result v0

    const/4 v1, 0x2

    if-ne v0, v1, :cond_0

    invoke-interface {p1}, Lorg/jboss/netty/buffer/ChannelBuffer;->readerIndex()I

    move-result v0

    invoke-interface {p1, v0}, Lorg/jboss/netty/buffer/ChannelBuffer;->getShort(I)S

    move-result v0

    if-nez v0, :cond_0

    .line 255
    .end local p1
    :goto_0
    return-object p1

    .line 254
    .restart local p1
    :cond_0
    iget-object v0, p0, Lorg/jboss/netty/handler/codec/spdy/SpdyFrameDecoder;->headerBlockDecompressor:Lorg/jboss/netty/handler/codec/embedder/DecoderEmbedder;

    invoke-virtual {v0, p1}, Lorg/jboss/netty/handler/codec/embedder/DecoderEmbedder;->offer(Ljava/lang/Object;)Z

    .line 255
    iget-object v0, p0, Lorg/jboss/netty/handler/codec/spdy/SpdyFrameDecoder;->headerBlockDecompressor:Lorg/jboss/netty/handler/codec/embedder/DecoderEmbedder;

    invoke-virtual {v0}, Lorg/jboss/netty/handler/codec/embedder/DecoderEmbedder;->poll()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lorg/jboss/netty/buffer/ChannelBuffer;

    move-object p1, v0

    goto :goto_0
.end method


# virtual methods
.method protected decode(Lorg/jboss/netty/channel/ChannelHandlerContext;Lorg/jboss/netty/channel/Channel;Lorg/jboss/netty/buffer/ChannelBuffer;)Ljava/lang/Object;
    .locals 16
    .parameter "ctx"
    .parameter "channel"
    .parameter "buffer"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/Exception;
        }
    .end annotation

    .prologue
    .line 45
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readableBytes()I

    move-result v13

    const/16 v14, 0x8

    if-ge v13, v14, :cond_0

    .line 46
    const/4 v8, 0x0

    .line 91
    :goto_0
    return-object v8

    .line 50
    :cond_0
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readerIndex()I

    move-result v6

    .line 51
    .local v6, frameOffset:I
    add-int/lit8 v7, v6, 0x5

    .line 52
    .local v7, lengthOffset:I
    move-object/from16 v0, p3

    invoke-static {v0, v7}, Lorg/jboss/netty/handler/codec/spdy/SpdyCodecUtil;->getUnsignedMedium(Lorg/jboss/netty/buffer/ChannelBuffer;I)I

    move-result v2

    .line 53
    .local v2, dataLength:I
    add-int/lit8 v5, v2, 0x8

    .line 56
    .local v5, frameLength:I
    invoke-interface/range {p3 .. p3}, Lorg/jboss/netty/buffer/ChannelBuffer;->readableBytes()I

    move-result v13

    if-ge v13, v5, :cond_1

    .line 57
    const/4 v8, 0x0

    goto :goto_0

    .line 61
    :cond_1
    move-object/from16 v0, p3

    invoke-interface {v0, v6}, Lorg/jboss/netty/buffer/ChannelBuffer;->getByte(I)B

    move-result v13

    and-int/lit16 v13, v13, 0x80

    if-eqz v13, :cond_2

    const/4 v1, 0x1

    .line 62
    .local v1, control:Z
    :goto_1
    add-int/lit8 v4, v6, 0x4

    .line 63
    .local v4, flagsOffset:I
    move-object/from16 v0, p3

    invoke-interface {v0, v4}, Lorg/jboss/netty/buffer/ChannelBuffer;->getByte(I)B

    move-result v3

    .line 65
    .local v3, flags:B
    if-eqz v1, :cond_4

    .line 67
    move-object/from16 v0, p3

    invoke-static {v0, v6}, Lorg/jboss/netty/handler/codec/spdy/SpdyCodecUtil;->getUnsignedShort(Lorg/jboss/netty/buffer/ChannelBuffer;I)I

    move-result v13

    and-int/lit16 v12, v13, 0x7fff

    .line 70
    .local v12, version:I
    const/4 v13, 0x2

    if-eq v12, v13, :cond_3

    .line 71
    move-object/from16 v0, p3

    invoke-interface {v0, v5}, Lorg/jboss/netty/buffer/ChannelBuffer;->skipBytes(I)V

    .line 72
    new-instance v13, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;

    new-instance v14, Ljava/lang/StringBuilder;

    invoke-direct {v14}, Ljava/lang/StringBuilder;-><init>()V

    const-string v15, "Unsupported version: "

    invoke-virtual {v14, v15}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v14

    invoke-virtual {v14, v12}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v14

    invoke-virtual {v14}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v14

    invoke-direct {v13, v14}, Lorg/jboss/netty/handler/codec/spdy/SpdyProtocolException;-><init>(Ljava/lang/String;)V

    throw v13

    .line 61
    .end local v1           #control:Z
    .end local v3           #flags:B
    .end local v4           #flagsOffset:I
    .end local v12           #version:I
    :cond_2
    const/4 v1, 0x0

    goto :goto_1

    .line 76
    .restart local v1       #control:Z
    .restart local v3       #flags:B
    .restart local v4       #flagsOffset:I
    .restart local v12       #version:I
    :cond_3
    add-int/lit8 v11, v6, 0x2

    .line 77
    .local v11, typeOffset:I
    move-object/from16 v0, p3

    invoke-static {v0, v11}, Lorg/jboss/netty/handler/codec/spdy/SpdyCodecUtil;->getUnsignedShort(Lorg/jboss/netty/buffer/ChannelBuffer;I)I

    move-result v10

    .line 78
    .local v10, type:I
    const/16 v13, 0x8

    move-object/from16 v0, p3

    invoke-interface {v0, v13}, Lorg/jboss/netty/buffer/ChannelBuffer;->skipBytes(I)V

    .line 80
    move-object/from16 v0, p3

    invoke-interface {v0, v2}, Lorg/jboss/netty/buffer/ChannelBuffer;->readBytes(I)Lorg/jboss/netty/buffer/ChannelBuffer;

    move-result-object v13

    move-object/from16 v0, p0

    invoke-direct {v0, v10, v3, v13}, Lorg/jboss/netty/handler/codec/spdy/SpdyFrameDecoder;->decodeControlFrame(IBLorg/jboss/netty/buffer/ChannelBuffer;)Ljava/lang/Object;

    move-result-object v8

    goto :goto_0

    .line 83
    .end local v10           #type:I
    .end local v11           #typeOffset:I
    .end local v12           #version:I
    :cond_4
    move-object/from16 v0, p3

    invoke-static {v0, v6}, Lorg/jboss/netty/handler/codec/spdy/SpdyCodecUtil;->getUnsignedInt(Lorg/jboss/netty/buffer/ChannelBuffer;I)I

    move-result v9

    .line 84
    .local v9, streamID:I
    const/16 v13, 0x8

    move-object/from16 v0, p3

    invoke-interface {v0, v13}, Lorg/jboss/netty/buffer/ChannelBuffer;->skipBytes(I)V

    .line 86
    new-instance v8, Lorg/jboss/netty/handler/codec/spdy/DefaultSpdyDataFrame;

    invoke-direct {v8, v9}, Lorg/jboss/netty/handler/codec/spdy/DefaultSpdyDataFrame;-><init>(I)V

    .line 87
    .local v8, spdyDataFrame:Lorg/jboss/netty/handler/codec/spdy/SpdyDataFrame;
    and-int/lit8 v13, v3, 0x1

    if-eqz v13, :cond_5

    const/4 v13, 0x1

    :goto_2
    invoke-interface {v8, v13}, Lorg/jboss/netty/handler/codec/spdy/SpdyDataFrame;->setLast(Z)V

    .line 88
    and-int/lit8 v13, v3, 0x2

    if-eqz v13, :cond_6

    const/4 v13, 0x1

    :goto_3
    invoke-interface {v8, v13}, Lorg/jboss/netty/handler/codec/spdy/SpdyDataFrame;->setCompressed(Z)V

    .line 89
    move-object/from16 v0, p3

    invoke-interface {v0, v2}, Lorg/jboss/netty/buffer/ChannelBuffer;->readBytes(I)Lorg/jboss/netty/buffer/ChannelBuffer;

    move-result-object v13

    invoke-interface {v8, v13}, Lorg/jboss/netty/handler/codec/spdy/SpdyDataFrame;->setData(Lorg/jboss/netty/buffer/ChannelBuffer;)V

    goto/16 :goto_0

    .line 87
    :cond_5
    const/4 v13, 0x0

    goto :goto_2

    .line 88
    :cond_6
    const/4 v13, 0x0

    goto :goto_3
.end method
